package com.slowly.kit;

import java.util.HashMap;
import java.util.Map;

/**
 * 返回前端页面标记工具类
 */
public class ActionResultKit {

	/**
	 * 返回标记 true
	 * @return
	 */
	public static Map<String, Object> getSuccMsg() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", true);
		map.put("msg", "success");
		return map;
	}

	/**
	 * 返回标记 true
	 * @param msg 提示信息
	 * @return
	 */
	public static Map<String, Object> getSuccMsg(String msg) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", true);
		map.put("msg", msg);
		return map;
	}
	/**
	 * 返回标记 true
	 * @param msg 提示信息
	 * @param data 返回数据
	 * @return
	 */
	public static Map<String, Object> getSuccMsg(String msg,Object data) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", true);
		map.put("msg", msg);
		map.put("data", data);
		return map;
	}
	/**
	 * 返回标记 false
	 * @param msg 提示信息
	 * @return
	 */
	public static Map<String, Object> getFailMsg(String msg) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", false);
		map.put("msg", msg);
		return map;
	}
	/**
	 * 返回标记 false
	 * @return
	 */
	public static Map<String, Object> getFailMsg() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", false);
		map.put("msg", "fail");
		return map;
	}
	/**
	 * 返回标记 false
	 * @param msg 错误提示信息
	 * @param data 返回数据
	 * @return
	 */
	public static Map<String, Object> getFailMsg(String msg,Object data) {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("success", false);
		map.put("msg", msg);
		map.put("data", data);
		return map;
	}
}
